import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import layout from "@/layout/index.vue"

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/index',
    name: 'Index',
    component: layout,
    redirect: '/index/work',
    meta: { title: '首页' },
    children: [
      {
        path: 'work',
        name: 'Work',
        component: () => import(/* webpackChunkName: "about" */ '../views/work.vue'),
        meta: { title: '工作台' },
      },
    ]
  },
  {
    path: '/member',
    name: "Member",
    component: layout,
    redirect: '/member',
    meta: { title: '人员管理' },
    children: [
      {
        path: '',
        name: 'Member',
        component: () => import(/* webpackChunkName: "about" */ '../views/member.vue'),
      },
    ]
  },
  {
    path: '/cuisine',
    name: "Cuisine",
    component: layout,
    redirect: '/cuisine/frog',
    meta: { title: '菜单管理' },
    children: [
      {
        path: 'frog',
        name: 'Frog',
        component: () => import(/* webpackChunkName: "about" */ '../views/face.vue'),
        meta: { title: '牛蛙' }
      },
      {
        path: 'ice',
        name: 'Ice',
        component: () => import(/* webpackChunkName: "about" */ '../views/ice.vue'),
        meta: { title: '冰粉' }
      },
      {
        path: 'drink',
        name: 'Drink',
        component: () => import(/* webpackChunkName: "about" */ '../views/cuisine/drink/drink.vue'),
        meta: { title: '饮品' },
        children: [
          {
            path: 'whisky',
            name: 'Whisky',
            component: () => import(/* webpackChunkName: "about" */ '../views/cuisine/drink/whisky/index.vue'),
            meta: { title: '威士忌' }
          }
        ]
      },
    ]
  },

  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "about" */ '../views/login.vue')
  },
  {
    path: '/:CatchAll(.*)',
    name: '404',
    component: () => import(/* webpackChunkName: "about" */ '../views/404page.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
